<?php

namespace App\Kuafu\Shop\Model;

use App\Kuafu\Base\Model\BaseModel;
use App\Kuafu\Base\Model\Traits\KfSoftDeletes;
use App\Kuafu\Base\Model\Traits\KfUid;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class CameraModel extends BaseModel
{
    use HasFactory, KfSoftDeletes, KfUid;

    protected $connection  = 'mysql';
    protected $table       = 'shop_camera';
    protected $fillable    = [
        'shopId',
        'type',
        'name',
        'serialNo',
        'deviceName',
        'mac',
        'sort',
        'status',
        'deviceType',
        'supplier',
        'type',
        'tripleType',
        'productKey',
        'deviceSecret',
        'queueSwitch',
        'soundSwitch',
        'bannerType',
        'createdAt',
        'updatedAt',
        'createdByUid',
        'updatedByUid',
    ];
    protected $modelCached = true;

    public const SUPPLIER_ALIYUN   = 1; // 阿里云
    public const SUPPLIER_YLK      = 2; // 悠络客
    public const SUPPLIER_YING_LIU = 3; // 影流-自研相机

    public const SUPPLIER_TEXT = [
        self::SUPPLIER_ALIYUN   => '阿里云',
        self::SUPPLIER_YLK      => '悠络客',
        self::SUPPLIER_YING_LIU => '自研',
    ];

    const DEVICE_TYPE_CAMERA = 0;
    const DEVICE_TYPE_TV     = 1;
    const DEVICE_TYPE_MMC    = 2;

    const DEVICE_TYPE_TEXT = [
        self::DEVICE_TYPE_CAMERA => "摄像机",
        self::DEVICE_TYPE_TV     => "商屏",
        self::DEVICE_TYPE_MMC    => "秒秒测"
    ];

    const DEVICE_TYPE_1_TYPE_0 = 0;
    const DEVICE_TYPE_1_TYPE_1 = 1;
    //展示屏子类型
    const DEVICE_TYPE_1_TYPE_TEXT = [
        self::DEVICE_TYPE_1_TYPE_0 => "展示屏",
        self::DEVICE_TYPE_1_TYPE_1 => "互动屏",
    ];

    const TV_POSITION_SORT_1 = 1;
    const TV_POSITION_SORT_2 = 2;
    const TV_POSITION_SORT_3 = 3;
    const TV_POSITION_SORT_4 = 4;
    const TV_POSITION_SORT_5 = 5;
    const TV_POSITION_SORT_6 = 6;

    const TV_POSITION_TEXT = [
        self::TV_POSITION_SORT_1 => "商屏 - 1号位",
        self::TV_POSITION_SORT_2 => "商屏 - 2号位",
        self::TV_POSITION_SORT_3 => "商屏 - 3号位",
        self::TV_POSITION_SORT_4 => "商屏 - 4号位",
        self::TV_POSITION_SORT_5 => "商屏 - 5号位",
        self::TV_POSITION_SORT_6 => "商屏 - 6号位",
    ];


    public function shopMonitorRataRel()
    {
        return $this->hasOne(ShopMonitorDataModel::class, 'monitorId', 'id');
    }

}
